﻿using System.Data;

namespace GeoWeb.Controls.WebGrid
{
    public class WebGridCellRenderingEventArgs
    {
        private WebGridColumn column;
        /// <summary>
        /// 当前单元格所在的的 WebGridColumn 列
        /// </summary>
        public WebGridColumn Column
        {
            get { return column; }
        }

        private DataRow row;
        /// <summary>
        /// 当前单元格所在行的数据行
        /// </summary>
        public DataRow Row
        {
            get { return row; }
        }

        private RowTypes rowType;
        /// <summary>
        /// 行的类型
        /// </summary>
        public RowTypes RowType
        {
            get { return rowType; }
        }

        private int rowIndex;
        /// <summary>
        /// 当前行的索引
        /// </summary>
        public int RowIndex
        {
            get { return rowIndex; }
        }

        private int columnIndex;
        /// <summary>
        /// 当前列的索引
        /// </summary>
        public int ColumnIndex
        {
            get { return columnIndex; }
        }

        private string formatString = string.Empty;
        /// <summary>
        /// 需要返回的格式化的字符串
        /// </summary>
        public string FormatString
        {
            get { return formatString; }
            set { formatString = value; }
        }

        private bool isFormat;
        /// <summary>
        /// 是否应用当前的格式化
        /// </summary>
        public bool IsFormat
        {
            get { return isFormat; }
            set { isFormat = value; }
        }

        internal WebGridCellRenderingEventArgs(
            WebGridColumn _column,
            RowTypes _rowType,
            int _columnIndex
            )
        {
            this.column = _column;
            this.rowType = _rowType;
            this.columnIndex = _columnIndex;
        }

        internal WebGridCellRenderingEventArgs(
            WebGridColumn _column,
            DataRow _row,
            RowTypes _rowType,
            int _rowIndex,
            int _columnIndex
            )
        {
            this.column = _column;
            this.row = _row;
            this.rowType = _rowType;
            this.rowIndex = _rowIndex;
            this.columnIndex = _columnIndex;
        }
    }

    public delegate void WebGridCellRenderingEventHandler(object sender, WebGridCellRenderingEventArgs e);
}
